package org.example.consultant.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.example.consultant.pojo.Reservation;
import org.springframework.context.annotation.Bean;

@Mapper

public interface ReservationMapper {
    @Insert("INSERT INTO reservation(name, gender, phone, communication_time, province, estimated_score) " +
            "VALUES(#{name}, #{gender}, #{phone}, #{communicationTime}, #{province}, #{estimatedScore})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(Reservation reservation);

    @Select("SELECT * FROM reservation WHERE phone = #{phone}")
    Reservation findByPhone(String phone);
}
